/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Util;

import com.mysql.jdbc.Connection;
import java.sql.DriverManager;

/**
 *
 * @author AD_DA
 */
public class DBConnection {
    public static Connection getConnection()
    {
       Connection conn=null;
       String driverString="com.mysql.jdbc.Driver";
       String connString="jdbc:mysql://localhost:3306/webjava";
       try{
           Class.forName(driverString);
           System.out.println("Đã load Driver");
           conn=(Connection) DriverManager.getConnection(connString, "Eroshaly", "140690");
           System.out.println("Kết nối thành công");
       }
       catch(Exception ex){
           ex.printStackTrace();
       }
       return conn;
    }
}
